//
//  HLTshopmapViewController.m
//  huiliantong
//
//  Created by hlt on 15/10/26.
//  Copyright © 2015年 hlt. All rights reserved.
//

#import "HLTshopmapViewController.h"

@interface HLTshopmapViewController ()<UIWebViewDelegate>

@end

@implementation HLTshopmapViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    _mywebview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, screen_width, screen_height)];
    
//    [self.view addSubview: _mywebview];
//    NSString *url=[NSString stringWithFormat:@"%@&user_name=%@",usercharge,acc.custPhone];
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



-(void) setmyWebview
{
    
    
    //由于有中文，所以转换url的时候失败了
    _url=[_url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *lastURL=[NSURL URLWithString:_url];
    
    NSMutableURLRequest *newRequest = [NSMutableURLRequest requestWithURL:lastURL];
    
    [_webview loadRequest:newRequest];
    
    self.webview.delegate=self;
    
}



- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    
    
    NSLog(@"%@",error);
    
}


- (void)webViewDidStartLoad:(UIWebView *)webView
{
    
    
    
    
    
    
}


- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    
    //     NSURL *lastURL=[NSURL URLWithString:@""];
    //    NSMutableURLRequest *newRequest = [NSMutableURLRequest requestWithURL:lastURL];
    //
    //    for (NSHTTPCookie *cookie in self.loginCookies)
    //    {
    //        NSString *cookieString = [NSString stringWithFormat:@"%@=%@", [cookie name], [cookie value]];
    //
    //        [newRequest setValue:cookieString forHTTPHeaderField:@"Cookie"];
    //
    //        NSLog(@"inserted cookie into request: %@", cookie);
    //    }
    //
    //    [webView loadRequest:newRequest];
    
    
    
    
    
    
    //    NSDictionary *properties = [[NSMutableDictionary alloc] init];
    //    [properties setValue:@"2s2mzx9mfcjentxuahghoj9salnfd8zlcaadd9sdaxc92" forKey:NSHTTPCookieValue];
    //    [properties setValue:@"interface_code" forKey:NSHTTPCookieName];
    //    [properties setValue:@"" forKey:NSHTTPCookieDomain];
    //    [properties setValue:[NSDate dateWithTimeIntervalSinceNow:60*60] forKey:NSHTTPCookieExpires];
    //    [properties setValue:@"/" forKey:NSHTTPCookiePath];
    //    NSHTTPCookie *cookie = [[NSHTTPCookie alloc] initWithProperties:properties];
    //
    //    NSArray *cookies=[NSArray arrayWithObjects:cookie,nil];
    //    NSDictionary *headers=[NSHTTPCookie requestHeaderFieldsWithCookies:cookies];
    //    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:[@"http://www.hltgz.com/wx/mobile/index.php?m=default&c=InterfaceApp&a=charge&interface_code=2s2mzx9mfcjentxuahghoj9salnfd8zlcaadd9sdaxc92&user_name=18285117540"  valueForKey:@"url"]]];
    //    [request setValue:[headers objectForKey:@"Cookie"] forHTTPHeaderField:@"Cookie"];
    //    [webView loadRequest:request];
    
    
    [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].style.background='#CCFFFF'"];
    
    
}





- (void)viewWillappear:(BOOL)animated
{
    //取消隐藏导航
        self.navigationController.navigationBarHidden = NO;
    
}



@end
